package com.example.ch7;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class HobbySelect
 */
public class HobbySelect extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public HobbySelect() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String hobby = request.getParameter("hobby");
		ArrayList<String> suggest = new ArrayList<String>();
		suggest.add(hobby + "-01");
		suggest.add(hobby + "-02");
		suggest.add(hobby + "-03");
		request.setAttribute("suggest", suggest);
		RequestDispatcher dispatcher = request.getRequestDispatcher("hoobyResault.jsp");
		dispatcher.forward(request, response);
	}

}
